-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement type ascription. #23773
Implement type ascription. #23773
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
And thanks for doing the rebase! |
@eddyb: Using those fns in middle::ty would be my first bet. Otherwise, it is a strictly syntactic property - you just need to know the context of the expression. If none of that works out, then you could check later in type checking (mem categorization, I guess) that if you find an ascription expression, and it's an lvalue, then check to see if there is an adjustment on that expression, if there is, error out at that stage. |
The issue was related to lifetime invariance in mutable lvalues, wasn't it? I do wonder what we do right now for I haven't had the chance to experiment with this fully. Oh and I didn't think of unsizing coercions on a pointer-type lvalue - but that would consume the lvalue, so it shouldn't have bad interactions with ascription. |
Some quick playpen experimentation suggests we do propagate expected types down, but we don't attempt coercions on lvalues: |
@eddyb that sounds right. In particular, the |
☔ The latest upstream changes (presumably #23857) made this pull request unmergeable. Please resolve the merge conflicts. |
After some discussion with @nrc conclusion was that I should take over this PR too. |
Closing in favor of an upcoming rebase by @nikomatsakis! |
I recently remembered that type ascription was supposed to land "any minute now" some time ago, is this still going to happen? PS: Also may I suggest not closing issues in favour of upcoming rebases until the latter are actually opened (just so as not to have things fall through cracks). Not trying to be passive aggresive, just a genuine suggestion! |
ping @nikomatsakis who was going to do the rebase |
I can see why we would close a PR if e.g. its functionality is going to be provided in a different manner (so that people do not waste their time reviewing code that isn't even close to what is planned to be added). But closing a PR based solely on an anticipated future rebase that has not been opened does seem misguided. After all, what if someone else were willing to do the rebase in the meantime? (In other words, I think that closing this PR may have been an error.) |
I'm fine reopening, I'm just trying to keep the queue clear! |
Is someone working on the rebase of this? |
I was supposed to, but I haven't had the time. I'd be happy to mentor an On Wed, Oct 7, 2015 at 3:42 PM, Andrew Paseltiner notifications@github.com
|
@nikomatsakis I'd like to attempt a rebase. Would you like to mentor |
I would be happy to, but there has been someone doing the rebase that I've On Sun, Oct 25, 2015 at 7:44 AM, Nicholas notifications@github.com wrote:
|
I had been working on the rebase, but haven't been able to work on it recently, so @GBGamer is welcome to take it over. |
Ah, OK. Did you have an intermediate branch that might be worth looing at? On Mon, Oct 26, 2015 at 2:11 PM, Andrew Paseltiner <notifications@github.com
|
Rebased #21836
cc @eddyb (didn't see any reply on irc), @nrc